package com.bjpowernode.web.config;

import com.bjpowernode.web.intercepter.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        String addPath [] ={"/loan/**"};//拦截
        String excludePath [] ={
                "/loan/loan",
                "/loan/loanInfo",
                "/loan/checkPhone",
                "/loan/login",
                "/loan/logout",
                "/loan/page/login",
                "loan/page/register",
                "/loan/sendSms"};//不拦截
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns(addPath).
                excludePathPatterns(excludePath);
    }
}
